﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WeiTap.Data.Core;
using WeiTap.Data.Utilities;

namespace WeiTap.Data.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //const string sql = "select UserName,IsLock from user where id=@0";
            try
            {
                var allDeleteTags = DataManager.GetAllTag(false).Result;
                foreach (var tag in allDeleteTags)
                {
                    Console.WriteLine($"待处理标签{tag.Name}");
                    var allSite = DataManager.GetAllWebSite(tag.Name).Result;
                    foreach (var site in allSite)
                    {
                        Console.WriteLine($"执行前{site.Tag_DYB}");
                        site.Tag_DYB=site.Tag_DYB.Replace(tag.Name + ",", "");
                        Console.WriteLine($"执行后{site.Tag_DYB}");
                        var r=DataManager.UpdateWebSite(site).Result;
                        Console.WriteLine($"结果{r}");
                        
                    }
                    Trace.WriteLine(tag.Name);

                }
            }
            catch (Exception ex)
            {

                throw;
            }
            Console.ReadLine();
            
        }

    }
}
